package com.fast.develop.meta.dm.enums;


import com.fast.develop.meta.dm.field.FieldType;

import java.util.Arrays;
import java.util.stream.Collectors;

/**
 * @author 莫寅
 * @createTime 2022-06-19 01:19
 * @desc：
 */
public enum BasicFieldType implements FieldType
{
    String("string", "字符"),
    Integer("integer", "数字"),
    Double("double", "浮点"),
    Date("date", "日期"),
    BigDecimal("big_decimal", "金额"),
    Text("text", "文本"),
    Image("text", "图片"),
    File("text", "文件")

    ;

    private String value;
    private String display;

    BasicFieldType(String value, String display) {
        this.value = value;
        this.display = display;
    }


    public static BasicFieldType create(Object name){
        return Arrays.stream(values())
                .filter(basicFieldType -> basicFieldType.name().equalsIgnoreCase(name.toString()))
                .collect(Collectors.toList())
                .get(0);
    }


    @Override
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String getDisplay() {
        return display;
    }


    public void setDisplay(String display) {
        this.display = display;
    }

}

